export tag=$(curl -s https://api.github.com/repos/tektoncd/cli/releases/latest | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
export file="tkn_${tag#*v}_Linux_x86_64.tar.gz"
# cli
# export tag=$(curl -Ls "https://api.github.com/repos/tektoncd/cli/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

# Get the tar.xz
curl -LO https://ghproxy.net/https://github.com/tektoncd/cli/releases/download/$tag/$file

# Extract tkn to your PATH (e.g. /usr/local/bin)
sudo tar xvzf $file -C /usr/local/bin tkn
sudo chmod +x /usr/local/bin/tkn
rm -rf $file
